<?php
// bootstrap.php

/**
* Bootstrap Doctrine.php, register autoloader specify
* configuration attributes and load models.	
*/

/*
* We need to create a php script for bootstrapping Doctrine and all the configuration for it. Create a file named bootstrap.php and place the following code in the file:
*/
require_once(dirname(__FILE__) . '/lib/Doctrine.php');
/*
* Now that we have the Doctrine class present, we need to register the class autoloader function in the bootstrap file:	
*/
spl_autoload_register(array('Doctrine', 'autoload'));
/*
*Lets also create the singleton Doctrine_Manager instance and assign it to a variable named $manager:
*/
$manager = Doctrine_Manager::getInstance();

$manager->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL);
$manager->setAttribute(Doctrine_Core::ATTR_EXPORT, Doctrine_Core::EXPORT_ALL);
$manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE);

/*
* Opening New Connections
* Opening a new database connection in Doctrine is very easy. If you wish to use PDO you can just initialize a new PDO object.
*/

/*
 * This part is content of APLICA20
 */
include_once(DP_BASE_DIR .'/base/conf/db/LoadConfFileDB.class.php');

$confFileDB = LoadConfFileDB::getInstance();
$dsn = 'mysql:dbname='.$confFileDB->getDB().';host='.$confFileDB->getHostDB().'';
$dbh = new PDO($dsn, $confFileDB->getUserDB(), $confFileDB->getPassDB());
$Doctrineconn = Doctrine_Manager::connection($dbh,'doctrine');
